feat: dx improvements for optimization package#139
Closed
andrewklatzke wants to merge 2 commits intoaklatze/AIC-2178/verify-runs-endpointfrom
Closed
feat: dx improvements for optimization package#139andrewklatzke wants to merge 2 commits intoaklatze/AIC-2178/verify-runs-endpointfrom
andrewklatzke wants to merge 2 commits intoaklatze/AIC-2178/verify-runs-endpointfrom
Conversation
jsonbailey
approved these changes
Apr 17, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
Describe the solution you've provided
Improves the developer experience when using the SDK and fixes a bug where the global model was being ignored for judges.
Describe alternatives you've considered
This is a QoL change for folks consuming this SDK method. Weren't really alternatives considered.
Additional context
the TLDR; here is that when implementing this against multiple frameworks I found myself falling into the pattern of specifying the same handler for both agents and judges. Since that's the case, I've updated it so that
handle_judge_callis optional and defaults tohandle_agent_callif it's not specified. With this change, the optimization config when using an LD-built config is reduced to just this:Additionally just adds an
is_evaluationflag as the final argument forhandle_agent_callso that if you're using the singular method you can still discern which is which if necessary.Note
Medium Risk
Public callback signatures change (new required boolean arg) and judge model selection logic is altered, which may break downstream integrations or change evaluation behavior if callers relied on per-judge model overrides.
Overview
Improves the optimization SDK callback surface by making
handle_judge_calloptional (defaults tohandle_agent_call) and adding a finalis_evaluation: boolargument to both agent and judge handler signatures so a single shared handler can distinguish generation vs. scoring.Fixes a judge bug where config-provided judge model names could override the globally configured
judge_model; judges now always run on the global judge model while still inheriting other judge flag parameters (e.g. temperature/tools). Also generalizesawait_if_neededto support any sync/async return type and updates unit tests accordingly.Reviewed by Cursor Bugbot for commit a386a27. Bugbot is set up for automated code reviews on this repo. Configure here.